<?php
$folder = opendir("{$_SERVER["DOCUMENT_ROOT"]}/modules/news/banners");
$pic_types = array("jpg", "jpeg", "gif", "png");
$index = array();
$text_data = array();
while ($file = readdir ($folder)) {
    if(in_array(substr(strtolower($file), strrpos($file,".") + 1),$pic_types)) {
        array_push($index,$file);
    }
}

closedir($folder);


$i = $_REQUEST["id"];
$text_file = substr ($index[$i],0,strpos($index[$i],".")) . ".html";
$filename ="{$_SERVER["DOCUMENT_ROOT"]}/modules/news/banners/" . $text_file;

if (file_exists($filename)) echo file_get_contents($filename );
else echo "PRC News";

?>
 